package holiday_demo;

public class ArrayReverse {
    public static void main(String[] args) {
        int[] array=new int[]{1,2,3,4,5,6,7,8,9,10,11};
        int temp;
        for (int i = 0; i < array.length; i++) {
            if(i> array.length/2)
                break;
            temp=array[i];
            //将数组对称的元素交换，如第一个和最后一个、第二个和倒数第二个
            array[i]= array[array.length-i-1];
            array[array.length-1-i]=temp;

        }
        System.out.println("展示逆序输出数组元素的结果：");
        for (int i = 0; i < array.length; i++)
            System.out.println("第"+(i+1)+"个元素为： "+array[i]);
    }
}
